package com.briup.bookstore.web.controller;

import com.briup.bookstore.common.model.entity.User;
import com.briup.bookstore.common.response.Result;
import com.briup.bookstore.service.AuthService;
import lombok.RequiredArgsConstructor;
import org.springframework.web.bind.annotation.PostMapping;
import org.springframework.web.bind.annotation.RequestBody;
import org.springframework.web.bind.annotation.RestController;

@RestController
@RequiredArgsConstructor
public class AuthController {

	private final AuthService authService;

	/**
	 * 用户登录接口
	 * @param user 登录参数
	 * @return
	 */
	@PostMapping("/login")
	public Result login(@RequestBody User user) {
        authService.login(user);
		return Result.ok("OK");
	}

	/**
	 * 退出登录
	 * @return
	 */
	@PostMapping("/logout")
	public Result logout() {
		return Result.ok();
	}
}
